# -*- coding: utf-8 -*-
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User
import django.utils.timezone as timezone

# Create your models here.

# User Table
# 
GENDER_CHOICES = ((True, '男性'), (False, '女性'))
class ChatUser(models.Model):
    Users = models.OneToOneField(User)                              				#用户登陆名、密码
    UserID = models.CharField(max_length =20,primary_key = True, verbose_name = u'用户ID')  #自增, 1,2,3,4
    UserGender = models.NullBooleanField(choices = GENDER_CHOICES, verbose_name = u'性别') #选填，可留空
    NickName = models.CharField(max_length = 20, verbose_name = u'昵称')            #用户真正名字
    UserEmail = models.EmailField(verbose_name = u'Email')
    Online  = models.IntegerField(default = 0,verbose_name = u'在线情况')
    RegisterTime = models.DateTimeField(default = timezone.now, auto_now_add = True, verbose_name = u'注册时间')          		#账户创建时间
    LastLoginTime = models.DateTimeField(auto_now = True, verbose_name = u'上次登录时间')           #账户最后一次登录时间
    LastLoginIP = models.IPAddressField(default = '127.0.0.1', verbose_name = u'上次登录IP')
    Note = models.CharField(default = 'None', max_length = 100, verbose_name = u'备注',null = True)

    def __unicode__(self):
        return self.Users.username